import org.junit.Assert;

public class NGuessNumberTest {

    @org.junit.Test
    public void generateAnswer() {
        int arr[] =  NGuessNumber.generateAnswer();
        Assert.assertEquals(4,NGuessNumber.generateAnswer().length);
        for (int i = 1 ; i <4 ; i ++){
            for (int j = 0 ; j < i ; j ++){
                Assert.assertEquals(true,arr[i]!=arr[j]);
            }
        }
        for (int i = 0 ; i < 4 ; i++){
            Assert.assertEquals(true,arr[i]<=9&&arr[i]>=0);
        }
    }

    @org.junit.Test
    public void getPlayerInput() {
    }

    @org.junit.Test
    public void compareGuessAnswerTest() {
        int[] numbers = {3,4,5,8};
        int[] guesslist = {6,5,2,1};
        Assert.assertEquals(true,
                        NGuessNumber.compareGuessAnswer(numbers,guesslist).contains("0A1B")
        );
    }

    @org.junit.Test
    public void compareGuessAnswerTest2() {
        int[] numbers = {1,2,3,4};
        int[] guesslist = {1,2,3,4};
        Assert.assertEquals(true,
                NGuessNumber.compareGuessAnswer(numbers,guesslist).contains("4A0B")
        );
    }

    @org.junit.Test
    public void isWinTest1() {
        String jg = "4A0B";
        Assert.assertEquals(true,
                NGuessNumber.isWin(jg)
        );
    }

    @org.junit.Test
    public void isWinTest2() {
        String jg = "0A0B";
        Assert.assertEquals(false,
                NGuessNumber.isWin(jg)
        );
    }
}